package test.administrator.example.com.mvptest1.login;

/**
 * Created by thinkpad on 2018/7/17.
 */

import java.util.HashMap;
import java.util.Map;

import test.administrator.example.com.mvptest1.framework.MvpModel;
import test.administrator.example.com.mvptest1.utils.HttpTask;
import test.administrator.example.com.mvptest1.utils.HttpUtils;

/**
 * M层->具体同事A
 */
public class LoginModel implements MvpModel {

	public void login(String username, String password, final HttpUtils.OnHttpResultListener onHttpResultListener) {
		Map<String, Object> params = new HashMap<>();
		params.put("type", "admin");
		params.put("user_name", username);
		params.put("password", password);
		new HttpTask.Builder()
				.method("POST")
				.url("http://192.168.43.177:8080/StuManager/Login")
				.paramMap(params)
				.onHttpResultListener(new HttpUtils.OnHttpResultListener() {
					@Override
					public void onResult(Object result) {
						onHttpResultListener.onResult(result);
					}
				}).build().execute();
	}

}
